<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        @font-face {
            font-family: "iconfont";
            src: url("https://zchuan-miy.oss-cn-hangzhou.aliyuncs.com/player-dir/2025-05-13/1747127214372.TTF");
        }

        #show {
            font-family: "iconfont";
        }
    </style>
</head>
<body>
<label>
    <input type="text">
</label>
<button type="button" onclick="show()">提交</button>
<div id="show"></div>
</body>
<script>
    function show() {
        var input = document.getElementsByTagName("input")[0];
        var show = document.getElementById("show");
        show.innerHTML = input.value;
    }

    function groupBy(arr, generateKey) {
        if (typeof generateKey === "string") {
            var propName = generateKey;
            generateKey = (item) => item[propName];
        }
        return arr.reduce((arr, item, index) => {
            var key = generateKey(item, index, arr);
            if (!arr[key]) {
                arr[key] = [];
            }
            arr[key].push(item);
            return arr;
        }, {});
    }

    var arr = [
        {
            "id": 681,
            "createTime": "2025-02-21 14:35:26",
            "orderStatus": 2,
            "totalPrice": "0.01",
            "refundAmount": "0.01",
            "screenplayName": "忘闻问切"
        },
        {
            "id": 677,
            "createTime": "2025-02-13 10:57:00",
            "orderStatus": 1,
            "totalPrice": "0.01",
            "refundAmount": "0.00",
            "screenplayName": "行在丝路"
        },
        {
            "id": 676,
            "createTime": "2025-02-13 10:33:32",
            "orderStatus": 1,
            "totalPrice": "0.01",
            "refundAmount": "0.00",
            "screenplayName": "行在丝路"
        },
        {
            "id": 675,
            "createTime": "2025-02-13 10:21:46",
            "orderStatus": 2,
            "totalPrice": "0.01",
            "refundAmount": "0.01",
            "screenplayName": "忘闻问切"
        },
        {
            "id": 674,
            "createTime": "2025-02-13 10:19:48",
            "orderStatus": 2,
            "totalPrice": "0.01",
            "refundAmount": "0.01",
            "screenplayName": "忘闻问切"
        },
        {
            "id": 673,
            "createTime": "2025-02-13 10:18:21",
            "orderStatus": 2,
            "totalPrice": "0.01",
            "refundAmount": "0.01",
            "screenplayName": "忘闻问切"
        },
        {
            "id": 672,
            "createTime": "2025-02-13 09:14:30",
            "orderStatus": 1,
            "totalPrice": "0.01",
            "refundAmount": "0.00",
            "screenplayName": "行在丝路"
        },
        {
            "id": 671,
            "createTime": "2025-02-13 09:13:35",
            "orderStatus": 1,
            "totalPrice": "0.01",
            "refundAmount": "0.00",
            "screenplayName": "行在丝路"
        },
        {
            "id": 669,
            "createTime": "2025-02-12 18:19:02",
            "orderStatus": 1,
            "totalPrice": "0.01",
            "refundAmount": "0.00",
            "screenplayName": "行在丝路"
        }
    ];

    // var obj = groupBy(arr, (e) => e.createTime.split(" ")[0]);
    var obj = groupBy(arr, 'id');
    console.log(obj);
</script>
</html>